<%--
  Created by IntelliJ IDEA.
  User: zjy
  Date: 2015/4/13
  Time: 16:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools"/>
<script type="text/javascript" src="${webRoot}/plug-in/fancybox/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="${webRoot}/plug-in/fancybox/fancybox/jquery.fancybox-1.3.4.js"></script>
<link rel="stylesheet" type="text/css" href="${webRoot}/plug-in/fancybox/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:1px;">
        <t:datagrid name="bankList" title="" actionUrl="consultantController.do?datagrid" idField="consultantId" fit="true"
                    queryMode="group" onLoadSuccess="bandImg">
            <t:dgCol title="consultantId" field="consultantId" hidden="true"></t:dgCol>
            <t:dgCol title="咨询师头像" field="aCustomerEntity.avatar"  extendParams="formatter:avatarFormatter;" align="center"></t:dgCol>
            <t:dgCol title="姓名" field="aCustomerEntity.realname" query="true"></t:dgCol>
            <t:dgCol title="性别" field="aCustomerEntity.sex" dictionary="sex"></t:dgCol>
            <t:dgCol title="手机号码" field="aCustomerEntity.phone" query="true" ></t:dgCol>
            <t:dgCol title="生日" field="aCustomerEntity.birthday" formatter="yyyy-MM-dd" query="true" ></t:dgCol>
            <t:dgCol title="省" field="aCustomerEntity.province"  ></t:dgCol>
            <t:dgCol title="市" field="aCustomerEntity.city" ></t:dgCol>
            <t:dgCol title="区" field="aCustomerEntity.area"  ></t:dgCol>
            <t:dgCol title="入驻时间" field="createTime" formatter="yyyy-MM-dd" query="true" ></t:dgCol>
            <t:dgCol title="最后登录" field="aCustomerEntity.lastLogintime" formatter="yyyy-MM-dd"  ></t:dgCol>
            <t:dgCol title="专家等级" field="isExpert" dictionary="isexpert"  ></t:dgCol>
            <t:dgCol title="是否系统推荐" field="isRecomm" dictionary="isno"  ></t:dgCol>
            <t:dgCol title="排序" field="sort"></t:dgCol>
            <t:dgCol title="状态" field="isAuth" query="true" dictionary="newapply" ></t:dgCol>

            <t:dgCol title="common.operation" field="opt" width="1"></t:dgCol>
            <t:dgFunOpt funname="f_auth(consultantId)" title="审核" ></t:dgFunOpt>
            <t:dgFunOpt funname="f_expert(consultantId)" title="设置专家等级" ></t:dgFunOpt>

            <t:dgConfOpt message="是否设置为首页显示咨询师?" url="consultantController.do?recomm&consultantId={consultantId}&isRecomm=1" title="推荐设置" exp="isRecomm#eq#0"></t:dgConfOpt>
            <t:dgConfOpt message="是否取消首页显示咨询师?" url="consultantController.do?recomm&consultantId={consultantId}&isRecomm=0" title="取消推荐" exp="isRecomm#eq#1"></t:dgConfOpt>

            <t:dgToolBar title="新增" icon="icon-add" url="consultantController.do?addorupdateView" funname="add"  width="1100" height="700"></t:dgToolBar>
            <t:dgToolBar title="修改" icon="icon-edit" url="consultantController.do?addorupdateView" funname="f_update"  width="1100" height="700"></t:dgToolBar>
            <t:dgToolBar title="查看" langArg="common.user" icon="icon-search" url="consultantController.do?previewView" funname="previewView"  width="1100" height="700"></t:dgToolBar>
        </t:datagrid>
    </div>
</div>
<script type="text/javascript">
    function avatarFormatter(val,row){
        return '<a rel="datagrid_group" href="'+val+'" title=""><img alt="" src="'+val+'" style="width:30px;height:30px;"></a>';
    }
    function bandImg(){
        $("a[rel=datagrid_group]").fancybox({
            'overlayShow'	: false,
            'transitionIn'	: 'elastic',
            'transitionOut'	: 'elastic'
        });
    }

    function f_update(title, url, id, width, height) {
        gridname=id;
        var rowsData = $('#'+id).datagrid('getSelections');
        if (!rowsData || rowsData.length==0) {
            tip('请选择编辑项目');
            return;
        }
        if (rowsData.length>1) {
            tip('请选择一条记录再编辑');
            return;
        }

        url += '&consultantId='+rowsData[0].consultantId;
        title="编辑咨询师信息";
        createwindow(title, url, width, height);
    }
    //认证
    function f_auth(consultantId){
        url = 'consultantController.do?authView&consultantId='+consultantId;
        title="审核咨询师";
        createwindow(title, url, 500, 400);
    }

    //认证专家
    function f_expert(consultantId){
        url = 'consultantController.do?expertView&consultantId='+consultantId;
        title="审核咨询师";
        createwindow(title, url, 500, 400);
    }
    //查看
    function previewView(title, url, id, width, height){
        gridname=id;
        var rowsData = $('#'+id).datagrid('getSelections');
        if (!rowsData || rowsData.length==0) {
            tip('请选择咨询师');
            return;
        }
        if (rowsData.length>1) {
            tip('请选择一个咨询师');
            return;
        }
        url += '&consultantId='+rowsData[0].consultantId;
        title="咨询师预览";
        createdetailwindow(title, url, width, height);
    }

</script>
